function initPage() {
	initSidebar();
	initTabs();
}


function initSidebar() {
	
	$("#sidebar a").click( loadWorkspace );
	
}//end function iniSidebar

function initTabs() {
	
	$("div.tabs a").click( selectPanel );
}


function loadWorkspace() {

	// get pageId
	var pageId = $(this).attr("id");
	
	
	// Initilize sidebar
	$("#sidebar a").each( function() {
		$(this).removeClass( "selected" );
	});
	
	$(this).addClass( "selected" );
	
	// Load corrsponding workspace
	var workspaceId = "#" + pageId + "Workspace";

	$("div.workspace").each( 
		function() {
			$(this).addClass( "hidden" );
		}
	);
	
	$(workspaceId).removeClass( "hidden" );
}//end function selectPage

function selectPanel() {
	var tabId = $(this).attr("id");
	
	
	var token = tabId.split("Tab");
	
	var pageId = "#"+token[0]+"Panel";
	
	$("div.tabs a").each(
		function() {
			$(this).removeClass("selected");
		}//end function
	);//end statement
	
	$(this).addClass( "selected" );
	
	$("div.panel").each( 
		function(){
			$(this).addClass( "hidden" );			
		}//end function
	);//end statement
	
	$(pageId).removeClass( "hidden" );
	
}//end function selectPanel